package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqNewSalesmanSheet;
import com.ruoyi.hqfinance.domain.vo.HqNewSalesmanSheetVo;
import com.ruoyi.hqfinance.mapper.HqNewSalesmanSheetMapper;
import com.ruoyi.hqfinance.service.HqNewSalesmanSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HqNewSalesmanSheetServiceImpl implements HqNewSalesmanSheetService {
    @Autowired
    private HqNewSalesmanSheetMapper hqNewSalesmanSheetMapper;
    @Override
    public List<HqNewSalesmanSheet> newSalesmanSheet(HqNewSalesmanSheetVo hqNewSalesmanSheetVo) {
        PageHelper.startPage(hqNewSalesmanSheetVo.getPageDate());
        List<HqNewSalesmanSheet> newSalesmanSheets = hqNewSalesmanSheetMapper.newSalesmanSheet(hqNewSalesmanSheetVo);
        assert newSalesmanSheets != null;
        for (HqNewSalesmanSheet hqNewSalesmanSheet : newSalesmanSheets){
            hqNewSalesmanSheet.setName("辽宁盘锦公司");
            hqNewSalesmanSheet.setNetworkCode("124000");
            if (hqNewSalesmanSheetVo.getCollectType() == 2){
                hqNewSalesmanSheet.setDate(hqNewSalesmanSheetVo.getStartTime() +"至" + hqNewSalesmanSheetVo.getEndTime());
            }
        }

        return newSalesmanSheets;
    }
}
